home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Copyright 2003 Slackware Linux, Inc., Concord, CA USA
- # All rights reserved.
- #
- # Redistribution and use of this script, with or without modification, is
- # permitted provided that the following conditions are met:
- #
- # 1. Redistributions of this script must retain the above copyright
- # notice, this list of conditions and the following disclaimer.
- #
- # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
-
- # Hardly modified by Damian Rakowski for KateOS <maestromae@kateos.org>
- # - added dependency tracking
-
- # globals
-
- TMP=/var/log/setup/tmp
- SERIE=" a ap d doc g e l m n opt t tcl x xap xfce kde gnome miniiso"
- # functions
-
- check_deps(){
- cat $1 | while read foo; do
- if [ "$foo" != "" ]; then
- if ! egrep "^$foo:" $TMP/TAGFILE 1>/dev/null 2>/dev/null; then
- echo "$foo: ADD" >> $TMP/TAGFILE
- for i in $SERIE ; do
- if [ -r $MODEL/$i/$foo ]; then
- check_deps $MODEL/$i/$foo
- fi
- done
- fi
- fi
- done
- }
-
- skip_rest(){
- for i in $SERIE ; do
- if [ -d $MODEL/$i ]; then
- for j in $MODEL/$i/* ; do
- if [ ! -d $j ]; then
- if ! egrep "^`basename $j`:" $TMP/TAGFILE 1>/dev/null 2>/dev/null ; then
- echo "`basename $j`: SKP" >> $TMP/TAGFILE
- fi
- fi
- done
- fi
- done
- }
-
- install_package(){
- for category in $SERIE ; do
- if [ -d $SRCPATH/$category ]; then
- # First, make sure there's at least one package:
- if ! ls $SRCPATH/$category/*.tgz 1> /dev/null 2> /dev/null ; then
- return 1
- fi
- for package in $SRCPATH/$category/*.tgz ; do
- pk=`basename $package`
- pk=`package_name $pk`
- if egrep -w "^$pk:" $TMP/TAGFILE 1>/dev/null 2>/dev/null; then
- installpkg -nodeps -force -root $ROOTDIR -infobox -tagfile $TMP/TAGFILE $package
- ERROR=$?
- else
- installpkg -nodeps -force -root $ROOTDIR -menu -priority OPT $package
- ERROR=$?
- fi
- if [ ! $ERROR = 0 ]; then
- errorcode $ERROR $package
- fi
-
- sed -e "/^$pk::*/d" $TMP/TAGFILE 1> $TMP/TAGFILEOUT
- mv -f $TMP/TAGFILEOUT $TMP/TAGFILE
-
- done
- fi
- done
- }
-
-
- package_name() {
- STRING=`basename $1 .tgz`
- # Check for old style package name with one segment:
- if [ "`echo $STRING | cut -f 1 -d -`" = "`echo $STRING | cut -f 2 -d -`" ]; then
- echo $STRING
- else # has more than one dash delimited segment
- # Count number of segments:
- INDEX=1
- while [ ! "`echo $STRING | cut -f $INDEX -d -`" = "" ]; do
- INDEX=`expr $INDEX + 1`
- done
- INDEX=`expr $INDEX - 1` # don't include the null value
- # If we don't have four segments, return the old-style (or out of spec) package name:
- if [ "$INDEX" = "2" -o "$INDEX" = "3" ]; then
- echo $STRING
- else # we have four or more segments, so we'll consider this a new-style name:
- NAME=`expr $INDEX - 3`
- NAME="`echo $STRING | cut -f 1-$NAME -d -`"
- echo $NAME
- fi
- fi
- }
-
- errorcode() {
- if [ $1 = 99 ]; then
- # User aborted installation
- exit 1
- else
- dialog --timeout 600 --title "`gettext setup "installpkg error"` #$1" --msgbox \
- "`gettext setup "There was a fatal error attempting to install"` $2. `gettext setup "The package may \
- be corrupt, the installation media may be bad, or something else \
- has caused the package to be unable to be read without error. You \
- may hit enter to continue if you wish, but if this is an important \
- required package then your installation may not work as-is."`" 11 70
- fi
- }
-
-
- remount_disc() {
- umount $DEVICE
- eject $DEVICE
- dialog --title "`gettext setup "INSERT NEXT DISC"`" --menu "`gettext setup "Please insert the next KateOS disc and \
- press ENTER to continue installing packages."`" \
- 10 62 2 \
- "`gettext setup "Continue"`" "`gettext setup "Install packages from the next disc"`" \
- "`gettext setup "Quit"`" "`gettext setup "Quit installing packages and finish up"`" 2> $TMP/reply
- if [ ! $? = 0 ]; then
- REPLY="`gettext setup "Quit"`"
- else
- REPLY="`cat $TMP/reply`"
- fi
- rm -f $TMP/reply
- if [ "$REPLY" = "`gettext setup "Quit"`" ]; then
- errorcode 99
- fi;
- mount $DEVICE $MOUNTPOINT 1> /dev/null 2> /dev/null
- }
-